"use strict";
cc._RF.push(module, '0c6a0uixetDaK8V5zHVR6Of', 'bagePrefab');
// Script/bagePrefab.js

"use strict";

cc.Class({
    extends: cc.Component,

    properties: {

        giftName: cc.Label,
        giftimage: cc.Node,
        statusLabel: cc.Label,
        timeLabek: cc.Label,
        sgiftName: cc.Label,
        sstatusLabel: cc.Label,
        spassLabel: cc.Label,
        stimeLabek: cc.Label

    },

    onLoad: function onLoad() {},
    start: function start() {},
    init: function init(bageDic) {

        if (bageDic["express_stat"] == 0) {

            console.log("未发货");
            this.giftName.node.active = true;
            this.statusLabel.node.active = true;
            this.timeLabek.node.active = true;

            this.giftName.getComponent(cc.Label).string = bageDic["name"];
            this.statusLabel.getComponent(cc.Label).string = "状态:未发货";
            this.timeLabek.getComponent(cc.Label).string = bageDic["send_time"] ? bageDic["send_time"] : "正在打包中";
        } else {
            console.log("已经发货");
            this.sgiftName.node.active = true;
            this.sstatusLabel.node.active = true;
            this.spassLabel.node.active = true;
            this.stimeLabek.node.active = true;

            this.sgiftName.getComponent(cc.Label).string = bageDic["name"] ? bageDic["name"] : "";
            this.sstatusLabel.getComponent(cc.Label).string = "状态:已发货";
            this.stimeLabek.getComponent(cc.Label).string = bageDic["send_time"] ? bageDic["send_time"] : "正在打包中";
            this.spassLabel.getComponent(cc.Label).string = bageDic["express_company"] + ":" + bageDic["express_no"];
        }
        var that = this;
        cc.loader.load({ url: bageDic["thumbnail"], type: 'png' }, function (err, img) {

            var mylogo = new cc.SpriteFrame(img);

            that.giftimage.getComponent(cc.Sprite).spriteFrame = mylogo;

            that.giftimage.width = 106;

            that.giftimage.height = 106;
        });
    }
});

cc._RF.pop();